package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>
 * 
 * <p>Description: </p>
 *
 * <p>Copyright (c) 2007</p>
 *
 * @author Andrew Carter
 * @version 
 */


/**
 * Enumerates the permissible light combine modes.
 * 
 * @author Andrew Carter
 */
public enum E_LightCombine {

	/** Ignore lights. */
	OFF("OFF", 0),

	/**
	 * Combine light states starting from the root node and working towards the
	 * given SceneElement. Ignore disabled states. Stop combining when lights ==
	 * MAX_LIGHTS_ALLOWED
	 */
	COMBINE_FIRST("COMBINE_FIRST", 1),

	/**
	 * Combine light states starting from the given Spatial and working towards
	 * the root. Ignore disabled states. Stop combining when lights ==
	 * MAX_LIGHTS_ALLOWED
	 */
	COMBINE_CLOSEST("COMBINE_CLOSEST", 2),

	/**
	 * Similar to COMBINE_CLOSEST, but if a disabled state is encountered, it
	 * will stop combining at that point. Stop combining when lights ==
	 * MAX_LIGHTS_ALLOWED
	 */
	COMBINE_RECENT_ENABLED("COMBINE_RECENT_ENABLED", 3),

	/** Inherit mode from parent. */
	INHERIT("INHERIT", 4),

	/** Do not combine light states, just use the most recent one. */
	REPLACE("REPLACE", 5);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_LightCombine(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_LightCombine getConstant(String name) {

		for (E_LightCombine constant : E_LightCombine.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_LightCombine getConstant(int type) {

		for (E_LightCombine constant : E_LightCombine.values()) {

			if (constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * 
	 * @return
	 */
	public int getType() {

		return value;
	}
}
